using Catastrophe.Common.AttributeEx;

namespace SiemensAmd.BasicData
{
	public class SieCncAmdEntity
	{
		[CapComData("/Channel/State/progStatus", "程序状态", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public ushort RunState { get; set; }

		public string RunStateDescribe => this.RunState switch
		{
			1 => "中断", 
			2 => "停止", 
			3 => "运行", 
			4 => "等待", 
			5 => "取消", 
			_ => "--", 
		};

		[CapComData("/Bag/State/opMode", "CNC工作模式", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public ushort WorkMode { get; set; }

		public string WorkModeDescribe => this.WorkMode switch
		{
			0 => "JOG", 
			1 => "MDI", 
			2 => "AUTO", 
			_ => "--", 
		};

		[CapComData("/Channel/Spindle/speedOvr", "主轴倍率", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double SpindleRate { get; set; }

		[CapComData("/Channel/Spindle/actSpeed", "主轴速度实际值", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double SpindleSpeedAct { get; set; }

		[CapComData("/Channel/Spindle/cmdSpeed", "主轴速度设定值", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double SpindleSpeedSet { get; set; }

		[CapComData("/Channel/MachineAxis/feedRateOvr", "进给倍率", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double FeedRate { get; set; }

		[CapComData("/Channel/MachineAxis/cmdFeedRate", "进给设定", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double FeedSpeedSet { get; set; }

		[CapComData("/Channel/MachineAxis/actFeedRate", "进给实际", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double FeedSpeedAct { get; set; }

		[CapComData("/Channel/ProgramInfo/actLineNumber", "当前NC指令的行号", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public long ProgActLineNumber { get; set; }

		[CapComData("/Channel/ProgramInfo/progName", "当前有效程序名", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public string ProgNameNow { get; set; }

		[CapComData("/Channel/ProgramInfo/actBlock", "执行代码", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public string ExeProgCode { get; set; }

		[CapComData("/Channel/State/actTNumber", "主轴T号", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public int SpindleTNo { get; set; }

		[CapComData("/Channel/State/actDNumber", "主轴D号", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public int SpindleDNo { get; set; }

		[CapComData("/Nck/Spindle/driveLoad", "主轴负载(%)", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double SpindleDriveLoad { get; set; }

		[CapComData("/Channel/MachineAxis/aaCurr", "进给轴/主轴的电流实际值，单位A（仅在PROFIdrive 驱动可用时）", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double SpindleCurr { get; set; }

		[CapComData("/Channel/State/acTime", "从程序段开始处的时间（秒）", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double ProgAcTime { get; set; }

		[CapComData("/Channel/ChannelDiagnose/operatingTime", "程序加工时间", OprTypeEnum.Read | OprTypeEnum.Write, AllowOprEnum.ReadAndWrite)]
		public double OperatingTime { get; set; }

		[CapComData("/Channel/ChannelDiagnose/cycleTime", "所选NC程序的运行时间（秒）", OprTypeEnum.Read | OprTypeEnum.Write, AllowOprEnum.ReadAndWrite)]
		public double CycleTime { get; set; }

		[CapComData("/Channel/State/totalParts", "所创建工件的总数", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double TotalParts { get; set; }

		[CapComData("/Channel/State/reqParts", "所需工件（工件设定值）的数", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double ReqParts { get; set; }

		[CapComData("/Channel/State/actParts", "当前所建工件的总数量", OprTypeEnum.Read, AllowOprEnum.ReadAndWrite)]
		public double ActParts { get; set; }
	}
}
